<!DOCTYPE html>
<meta charset=utf-8>
<title>Syntax Highlighting</title>
<link href="../themes/css/monokai.css" rel="stylesheet" type="text/css" media="screen">
<body>
    <pre><code class="language-js">/*
 * This is some sample code to illustrate how things look!
 */
import * as templates from './somewhere';
import Musician from './musician';

const something = true;
export let blah = 123;
var somethingElse = false;

function test() {
    return new Promise((resolve, reject) => {
        resolve();
    });
}

class SomeClass {
    render() {
        return templates.helloWorld();
    }
}

class TaylorSwift extends Musician {
    constructor(position) {
        super(position);
    }

    get yearOfBirth() {
        return 1989;
    }

    perform(song) {
        this.sing(song)
    }
}

export default Paul;</code></pre>

    <pre data-language="javascript">
<code>/**
 * test function
 *
 * @param string
 * @return string
 */
function blah(foo, blah) {
    var test = 25;

    console.log(test.length);

    // if foo is true then return this string
    if (foo === true) {
        return 'foo is true';
    }
    return 'foo is false';
}

$(document).ready(function() {
    $("table").on("click", "td", function() {
        console.log('td click');
    });
});
</code></pre>

<pre>
<code data-language="javascript">window.Rainbow = {
    whatever: function(param) {

    },

    another: function(param) {

    }
};</code>
</pre>

<pre>
<code data-language="javascript">window.Rainbow = window.Rainbow || {};

Rainbow.extend('javascript', [
    {
        'name': 'selector',
        'pattern': /\$(?=\.|\()/g
    }
]);</code>
</pre>

<pre>
<code data-language="javascript">/**
 * cross browser get attribute for an element
 *
 * @see http://stackoverflow.com/questions/3755227/cross-browser-javascript-getattribute-method
 *
 * @param {Element} el
 * @param {string} attr     attribute you are trying to get
 * @returns {string}
 */
function _attr(el, attr) {
    var result = (el.getAttribute &amp;&amp; el.getAttribute(attr)) || null;

    if (!result) {
        var attrs = el.attributes,
            length = attrs.length,
            i;

        for (i = 0; i &lt; length; ++i) {
            if (attr[i].nodeName === attr) {
                result = attr[i].nodeValue;
            }
        }
    }

    return result;
}</code>
</pre>

    <script src="../dist/rainbow.js"></script>
    <script src="../src/language/generic.js"></script>
    <script src="../src/language/javascript.js"></script>
</body>
